#include <iostream>

using namespace std;

int main(void)
{
    // 逻辑运算符

    // 非 !
    int n = 10;
    // 在C++中，除了0都为真
    cout << !n << endl;
    cout << !!n << endl;

    // 与 &&

    int a = 10;
    int b = 10;
    cout << (a && b) << endl;

    a = 0;
    b = 10;
    cout << (a && b) << endl;

    a = 0;
    b = 0;
    cout << (a && b) << endl;
    // 同真为真，有假为假

    // 或 ||
    a = 10;
    b = 10;
    cout << (a || b) << endl;

    a = 0;
    b = 10;
    cout << (a || b) << endl;

    a = 0;
    b = 0;
    cout << (a || b) << endl;
    // 有真为真，同假为假

    return 0;
} 